﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UserControls
{
    public partial class Title : System.Web.UI.UserControl
    {
        public enum Mode
        {
            SingleLine,
            MultiLine
        }

        public Mode TextMode
        {
            get;
            set;
        }

        public string Content
        {
            get 
            {
                if (TextMode == Mode.SingleLine)
                {
                    return lblTitle.Text;
                }
                else
                {
                    return pDescription.InnerText;
                }
            }
            set
            {
                if (TextMode == Mode.SingleLine)
                {
                    lblTitle.Text = value;
                    txtTite.Text = value;
                }
                else
                {
                    pDescription.InnerText = value;
                    txtDesc.Text = value;
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (TextMode == Mode.MultiLine)
            {
                pnlDescription.Visible = true;
                pnlTitle.Visible = false;
            }
            else
            {
                pnlDescription.Visible = false;
                pnlTitle.Visible = true;
            }
        }
    }
}